﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ObviousCode.Aspect.PluginLibrary.Interfaces;
using ObviousCode.UI.Aspect.Persistence.AspectSurface.Savers;
using ObviousCode.Common.Utils.Library.Dictionaries;
using ObviousCode.Aspect.PluginLibrary.Caches;

namespace ObviousCode.UI.Aspect.Persistence.AspectSurface.Loaders
{
    public class SurfaceLoader_V1 : SurfaceLoader
    {
        protected override void PerformLoad(IAspectSurface parent, PropertyDictionary saveData)
        {
            PropertyArray objects = saveData.ArrayFor("surface-objects");

            foreach (object id in objects)
            {
                parent.AddSurfaceObject(AspectCache.Main.GetSurfaceObject(id.ToString()));
            }

            PropertyArray relationships = saveData.ArrayFor("surface-relationships");

            foreach (object id in relationships)
            {
                parent.AddSurfaceRelationship(AspectCache.Main.GetSurfaceRelationship(id.ToString()));
            }
        }

        public override int Version
        {
            get { return 1; }
        }

        public override string Tag
        {
            get { return SurfaceSaver.ObjectTag; }
        }

        public override int LoadSteps
        {
            get { throw new NotImplementedException(); }
        }
    }
}
